#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
void solve()
{
    string s1, s2;
    cin >> s1 >> s2;
    if (toupper(s1[0]) == toupper(s2[0]))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
int main()
{
    ll t;
    cin >> t;
    while (t--)
        solve();
    return 0;
}
